<template>
  <basic-container>
    <avue-crud
        v-if="tableOption"
        v-bind="bindVal"
        v-on="onEvent"
        v-model:page="page"
        v-model="startForm">
      <template #menu="scope">
        <el-button v-if="!scope.row.userDefault" type="primary" text @click="updateCommentDefault(scope.row)">设为默认
        </el-button>
      </template>
    </avue-crud>

  </basic-container>
</template>
<script>
import {createDynamicMixin} from "@/mixins/startCrud";
import {updateUserCommentDefaultById} from "@/api/start/activiti/core/myActCommentApi";

export default {
  name: "myActCommentPage",
  mixins: [createDynamicMixin({
    name: "start/activiti/my/myActComment",
    apiPath: "start/activiti/core/myActComment",
  })],
  components: {},
  methods: {

    updateCommentDefault(row) {
      const loading = this.$loading({
        lock: true,
        text: `正在设置默认审批意见，请稍后`,
        spinner: "el-icon-loading"
      });
      updateUserCommentDefaultById(row.id).then(res => {
        this.refreshChange()
        this.$message.success("操作成功")
      }).catch(err => {
      }).finally(() => loading.close())
    },
  },

}
</script>

<style scoped>

</style>